home *** CD-ROM | disk | FTP | other *** search
- #ifndef FWSHPLST_H
- #define FWSHPLST_H
-
- //========================================================================================
- //
- // File: FWShpLst.h
- // Release Version: $ 1.0d11 $
- //
- // Copyright: © 1995 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- // ----- Foundation Includes -----
-
- #ifndef FWAUTODE_H
- #include <FWAutoDe.h>
- #endif
-
- // ----- OS Includes
-
- #ifndef FWGROBJ_H
- #include "FWGrObj.h"
- #endif
-
- // ----- OpenDoc Includes -----
-
- #ifdef _ODTYPES_
- #include <ODTypes.h>
- #endif
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export on
- #endif
-
- //========================================================================================
- // Forward Declarations
- //========================================================================================
-
- class FW_CLASS_ATTR FW_CGraphicContext;
- class FW_CLASS_ATTR FW_CPoint;
- class FW_CLASS_ATTR FW_CRect;
- class FW_CLASS_ATTR FW_CShape;
-
- class FW_CLASS_ATTR FW_PShapeList;
- class FW_CLASS_ATTR FW_CShapeListRep;
-
- class FW_CLASS_ATTR FW_CShapeListIterator;
-
- class FW_CPrivShapeListNode; // Private class; no "FW_CLASS_ATTR"
-
- //========================================================================================
- // class FW_PShapeList
- //========================================================================================
-
- class FW_CLASS_ATTR FW_PShapeList : public FW_CGraphicCountedPtr
- {
- public:
- FW_DECLARE_CLASS
-
- public:
- FW_PShapeList();
- FW_PShapeList(FW_CShapeListRep* rep);
- FW_PShapeList(FW_CReadableStream& archive);
- virtual ~FW_PShapeList();
-
- FW_PShapeList(const FW_PShapeList& other);
- FW_PShapeList& operator=(const FW_PShapeList& other);
-
- FW_CShapeListRep* operator->();
- const FW_CShapeListRep* operator->() const;
- };
-
- //----------------------------------------------------------------------------------------
- // FW_PShapeList::operator->
- //----------------------------------------------------------------------------------------
-
- inline FW_CShapeListRep* FW_PShapeList::operator->()
- {
- return (FW_CShapeListRep*) GetRep();
- }
-
- //----------------------------------------------------------------------------------------
- // FW_PShapeList::operator->
- //----------------------------------------------------------------------------------------
-
- inline const FW_CShapeListRep* FW_PShapeList::operator->() const
- {
- return (const FW_CShapeListRep*) GetRep();
- }
-
- //========================================================================================
- // class FW_CShapeListRep
- //========================================================================================
-
- class FW_CLASS_ATTR FW_CShapeListRep : public FW_CGraphicCountedPtrRep
- {
- public:
- FW_DECLARE_CLASS
-
- friend FW_CShapeListIterator;
-
- //----------------------------------------------------------------------------------------
- // Constructors/Destructors
- //
-
- public:
-
- FW_CShapeListRep();
- FW_CShapeListRep(const FW_CShapeListRep& other);
- FW_CShapeListRep(FW_CReadableStream& archive);
- virtual ~FW_CShapeListRep();
-
- //----------------------------------------------------------------------------------------
- // Inherited API
- //
- public:
- virtual void Flatten(FW_CWritableStream& archive) const;
- virtual FW_Boolean IsEqual(const FW_CGraphicCountedPtrRep* other) const;
-
- //----------------------------------------------------------------------------------------
- // New API
- //
-
- // ----- Adding shapes
-
- void AdoptAtFront(FW_CShape* shape);
- void AdoptAtBack(FW_CShape* shape);
- void AdoptAfter(FW_CShape* shapeToAdd, FW_CShape* afterWhich);
- void AdoptBefore(FW_CShape* shapeToAdd, FW_CShape* beforeWhich);
-
- // ----- Removing shapes
-
- void Remove(FW_CShape* shape);
- void RemoveAll();
- FW_CShape* RemoveTop();
- FW_CShape* RemoveBottom();
-
- // ----- List operations
-
- FW_Boolean Contains(FW_CShape* shape) const;
- unsigned long GetCount() const;
- void Purge();
-
- // ----- Z-Order methods
-
- FW_Boolean MoveForward(FW_CShape* shape);
- FW_Boolean MoveToFront(FW_CShape* shape);
-
- FW_Boolean MoveBack(FW_CShape* shape);
- FW_Boolean MoveToBack(FW_CShape* shape);
-
- // ----- Copying
-
- FW_PShapeList Copy() const;
-
- // ----- Archiving
-
- static void* Read(FW_CReadableStream& archive);
-
- //----------------------------------------------------------------------------------------
- // Implementation
- //
-
- private:
- FW_CPrivShapeListNode* fHead;
- FW_CPrivShapeListNode* fTail;
- unsigned long fCount;
-
- FW_CPrivShapeListNode* FindNode(FW_CShape* shape) const;
- };
-
- //========================================================================================
- // class FW_CShapeListIterator
- //========================================================================================
-
- class FW_CLASS_ATTR FW_CShapeListIterator FW_AUTO_DESTRUCT_OBJECT
- {
- public:
- FW_DECLARE_CLASS
-
- //----------------------------------------------------------------------------------------
- // Constructors/Destructors
- //
- enum EDirection
- {
- kFrontToBack, // Z-order
- kBackToFront
- };
-
-
- FW_CShapeListIterator(EDirection direction, const FW_PShapeList& shapeList);
- FW_CShapeListIterator(EDirection direction, const FW_CShapeListRep* shapeListRep);
- virtual ~FW_CShapeListIterator();
-
- //----------------------------------------------------------------------------------------
- // Iteration
- //
-
- FW_CShape* First();
- FW_CShape* Next();
-
- FW_Boolean IsNotComplete() const;
-
- //----------------------------------------------------------------------------------------
- // Implementation
- //
-
- private:
- FW_CPrivShapeListNode* fFirst;
- FW_CPrivShapeListNode* fPastLast;
- FW_CPrivShapeListNode* fCurrent;
- EDirection fDirection;
-
- void CommonInit(EDirection direction,
- FW_CPrivShapeListNode* head,
- FW_CPrivShapeListNode* tail);
- };
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export off
- #endif
-
- #endif // FWSHPLST_H
-